#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "app_runner.h"
#include "daemon_runner.h"
#include "ota_runner.h"

int main(int argc, char const *argv[])
{
    if (argc < 2)
    {
        printf("Usage: %s app|ota|daemon\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    if (strcmp(argv[1], "app") == 0)
    {
        app_runner_run();
    }
    else if (strcmp(argv[1], "daemon") == 0)
    {
        daemon_runner_run();
    }
    else if (strcmp(argv[1], "ota") == 0)
    {
        ota_runner_run();
    }
    else if (strcmp(argv[1], "version") == 0)
    {
        printf("Version: %d.%d.%d\n", MAJOR, MINOR, PATCH);
    }
    else
    {
        printf("Unknown part!\nUsage: %s app|ota|daemon\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    return 0;
}
